import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import User from '../views/demend/User.vue'
import House from '../views/demend/House.vue'
import Fee from '../views/demend/Fee.vue'
import Enter from '../views/demend/Enter.vue'
import Customer from '../views/demend/Customer.vue'
import Check from '../views/demend/Check.vue'
import Record from '../views/demend/Record.vue'
import FeePrint from '../views/demend/FeePrint.vue'
import Home from '../components/Home.vue'

Vue.use(VueRouter)

// // 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
// const originalPush = VueRouter.prototype.push
// VueRouter.prototype.push = function push(location) {
//   return originalPush.call(this, location).catch(err => err)
// }

const routes = [
  {
    path: '/',
    name: 'Login',
    component: Login
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/user',
    name: 'User',
    component: User
  },
  {
    path: '/house',
    name: 'House',
    component: House
  },
  {
    path: '/fee',
    name: 'Fee',
    component: Fee
  },
  {
    path: '/enter',
    name: 'Enter',
    component: Enter
  },
  {
    path: '/customer',
    name: 'Customer',
    component: Customer
  },
  {
    path: '/check',
    name: 'Check',
    component: Check
  },
  {
    path: '/record',
    name: 'Record',
    component: Record
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
  },
  {
    path: '/feePrint/:id',
    name: 'FeePrint',
    component: FeePrint,
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
